package org.yoao.crm.acl;

public class Premission {

	public Premission() {
		
	}
	
	public boolean getMenuList(String relations,String access){
		if(relations == null || relations.trim().equals(""))
			return false;
		if(access == null || access.trim().equals(""))
			return true;
		String[] userSno = relations.split(";");
		String[] dbSno = access.split(";");
		for(int i=0;i<userSno.length;i++){
			for(int j=0;j<dbSno.length;j++){
				if(userSno[i].equalsIgnoreCase(dbSno[j]))
					return true;
			}
		}		
		return false;		
	}
	
	public boolean getMenuList(String[] relations,String[] access){
		if(relations == null || relations.length == 0)
			return false;
		if(access == null || access.length == 0)
			return true;
		for(int i=0;i<relations.length;i++){
			for(int j=0;j<access.length;j++){
				if(relations[i].equalsIgnoreCase(access[j]))
					return true;
			}
		}
		return false;		
	}
}